﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Entity.Car_Rental;
using Data.Car_Rental;
namespace Background.Controllers
{
    public class CategoryController : Controller
    {
        CategoryRepository categoryRepository = new CategoryRepository();
        //
        // GET: /Category/

        public ActionResult Index()
        {
            return View(categoryRepository.GetModel());
        }

        public ActionResult Create()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Create(Category entity)
        {

            categoryRepository.Insert(entity);
            return RedirectToAction("Index");
        }

        public ActionResult Delete(int id)
        {
            categoryRepository.Delete(new Category { ID = id });
            return RedirectToAction("Index");
        }
    }
}
